{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b33d8459",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'numpy.ndarray' object has no attribute 'len'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Input \u001b[1;32mIn [15]\u001b[0m, in \u001b[0;36m<cell line: 8>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      6\u001b[0m x_data \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mfrom_numpy(xy[:,:\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m])\n\u001b[0;32m      7\u001b[0m y_data \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mfrom_numpy(xy[:,[\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m]])\n\u001b[1;32m----> 8\u001b[0m \u001b[43mxy\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlen\u001b[49m\n",
      "\u001b[1;31mAttributeError\u001b[0m: 'numpy.ndarray' object has no attribute 'len'"
     ]
    }
   ],
   "source": [
    "#加载数据\n",
    "import numpy as np\n",
    "import torch\n",
    "import pandas as pd\n",
    "xy = np.loadtxt(r\"D:\\BaiduNetdiskDownload\\PyTorch深度学习实践\\diabetes.csv.gz\",delimiter = ',',dtype = np.float32)\n",
    "x_data = torch.from_numpy(xy[:,:-1])\n",
    "y_data = torch.from_numpy(xy[:,[-1]])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "53f6bec4",
   "metadata": {},
   "outputs": [],
   "source": [
    "#构造模型\n",
    "class Model(torch.nn.Module):\n",
    "    def __init__(self):\n",
    "        super(Model,self).__init__()\n",
    "        self.linear1 = torch.nn.Linear(8,6)\n",
    "        self.linear2 = torch.nn.Linear(6,4)\n",
    "        self.linear3 = torch.nn.Linear(4,1)\n",
    "        self.sigmoid = torch.nn.Sigmoid()\n",
    "    def forward(self,x):\n",
    "        x = self.sigmoid(self.linear1(x))\n",
    "        x = self.sigmoid(self.linear2(x))\n",
    "        x = self.sigmoid(self.linear3(x))\n",
    "        return x\n",
    "model = Model()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "dff62d5f",
   "metadata": {},
   "outputs": [],
   "source": [
    "#构造损失函数和优化器\n",
    "criterion = torch.nn.BCELoss(reduction = 'mean')\n",
    "optimizer = torch.optim.SGD(model.parameters(),lr = 0.05)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "97a198b6",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 0.6454635262489319\n",
      "1 0.6454592943191528\n",
      "2 0.6454553604125977\n",
      "3 0.645451545715332\n",
      "4 0.645447850227356\n",
      "5 0.6454442739486694\n",
      "6 0.6454409956932068\n",
      "7 0.6454377174377441\n",
      "8 0.6454347372055054\n",
      "9 0.6454318165779114\n",
      "10 0.6454288959503174\n",
      "11 0.6454262137413025\n",
      "12 0.6454236507415771\n",
      "13 0.6454212069511414\n",
      "14 0.6454187631607056\n",
      "15 0.6454164385795593\n",
      "16 0.6454142928123474\n",
      "17 0.6454121470451355\n",
      "18 0.6454101204872131\n",
      "19 0.6454082131385803\n",
      "20 0.6454064249992371\n",
      "21 0.645404577255249\n",
      "22 0.6454029083251953\n",
      "23 0.6454012393951416\n",
      "24 0.6453996896743774\n",
      "25 0.6453981995582581\n",
      "26 0.6453966498374939\n",
      "27 0.6453952789306641\n",
      "28 0.645393967628479\n",
      "29 0.6453925967216492\n",
      "30 0.6453914046287537\n",
      "31 0.6453901529312134\n",
      "32 0.6453890204429626\n",
      "33 0.6453878879547119\n",
      "34 0.645386815071106\n",
      "35 0.6453858017921448\n",
      "36 0.6453847885131836\n",
      "37 0.6453837752342224\n",
      "38 0.645382821559906\n",
      "39 0.6453819870948792\n",
      "40 0.6453810334205627\n",
      "41 0.6453802585601807\n",
      "42 0.6453794240951538\n",
      "43 0.6453786492347717\n",
      "44 0.6453778743743896\n",
      "45 0.6453771591186523\n",
      "46 0.6453763842582703\n",
      "47 0.645375669002533\n",
      "48 0.6453750133514404\n",
      "49 0.6453743577003479\n",
      "50 0.6453737616539001\n",
      "51 0.6453731656074524\n",
      "52 0.6453724503517151\n",
      "53 0.6453718543052673\n",
      "54 0.6453713774681091\n",
      "55 0.6453708410263062\n",
      "56 0.6453702449798584\n",
      "57 0.6453697085380554\n",
      "58 0.6453691720962524\n",
      "59 0.6453686952590942\n",
      "60 0.6453681588172913\n",
      "61 0.6453677415847778\n",
      "62 0.6453672647476196\n",
      "63 0.6453667879104614\n",
      "64 0.645366370677948\n",
      "65 0.6453658938407898\n",
      "66 0.6453654766082764\n",
      "67 0.6453650593757629\n",
      "68 0.6453646421432495\n",
      "69 0.6453642249107361\n",
      "70 0.6453638672828674\n",
      "71 0.645363450050354\n",
      "72 0.6453630924224854\n",
      "73 0.6453626751899719\n",
      "74 0.645362377166748\n",
      "75 0.6453619599342346\n",
      "76 0.6453616619110107\n",
      "77 0.6453612446784973\n",
      "78 0.6453608870506287\n",
      "79 0.64536052942276\n",
      "80 0.6453601717948914\n",
      "81 0.6453598737716675\n",
      "82 0.6453595161437988\n",
      "83 0.6453592777252197\n",
      "84 0.6453588604927063\n",
      "85 0.6453586220741272\n",
      "86 0.6453582644462585\n",
      "87 0.6453579664230347\n",
      "88 0.645357608795166\n",
      "89 0.6453573107719421\n",
      "90 0.6453570127487183\n",
      "91 0.6453567147254944\n",
      "92 0.6453564167022705\n",
      "93 0.6453561782836914\n",
      "94 0.6453558206558228\n",
      "95 0.6453555226325989\n",
      "96 0.6453552842140198\n",
      "97 0.6453549265861511\n",
      "98 0.645354688167572\n",
      "99 0.6453543901443481\n"
     ]
    }
   ],
   "source": [
    "#训练模型\n",
    "n = []\n",
    "l = []\n",
    "for epoch in range(100):\n",
    "    y_pred = model(x_data)\n",
    "    loss = criterion(y_pred, y_data)\n",
    "    print(epoch,loss.item())\n",
    "    n.append(epoch)\n",
    "    l.append(loss.item())\n",
    "    \n",
    "    optimizer.zero_grad()\n",
    "    loss.backward()\n",
    "    optimizer.step()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "077cb800",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAD4CAYAAAAQP7oXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAAsTAAALEwEAmpwYAAApP0lEQVR4nO3deXxV1bn/8c+TiSkJyBSUwaAElUFRAmKVoVYR63xtrUgd2qrtT2m1VltstbXaydah3iu3Vq1ebUvVWktptWKlWpygBARkEEEGCaKEeYaQPL8/1qY5xISckGEnJ9/363VeOWfvdfZ5tgfzzVprD+buiIiIJCMt7gJERKT5UGiIiEjSFBoiIpI0hYaIiCRNoSEiIknLiLuAhtS5c2fPz8+PuwwRkWZl9uzZ6929S1XrUjo08vPzKSoqirsMEZFmxcxWVbdOw1MiIpI0hYaIiCRNoSEiIklL6TkNEZH6UFpaSnFxMbt37467lHrVunVrevToQWZmZtLvUWiIiNSguLiYnJwc8vPzMbO4y6kX7s6GDRsoLi6md+/eSb9Pw1MiIjXYvXs3nTp1SpnAADAzOnXqVOvek0KjOu7g5XFXISJNRCoFxn6Hsk8Kjaqsegb+fgIUT467EhGRJkWhUZVda2HzO7D013FXIiICQHZ2dtwlAAqNqvW+HNJawUcvwfYVcVcjItJkKDSq0qoj9LokPF/2SLy1iIgkcHduueUWBgwYwMCBA3n66acBWLt2LSNGjGDQoEEMGDCA1157jbKyMq666qr/tL3//vvr/PlJHXJrZmOAB4B04FF3/1kVbS4B7gAcmOfulyWsywUWAZPdfXy07FXgcGBX1Gy0u69LeM/FwLPAEHcvip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oDU+86LgWJ3nxm9fpYQIqn+XZ8BrHD3EncvBZ4jfP+p/F0nqu77rdPvOIXGJ80CCqIjLLIIE2dTYq6p3kXj+L8BFrv7fQmrpgBXRs+vBP7S2LU1JHe/1d17uHs+4bv9p7uPA14BPhc1S6n9dvePgNVmdky06DPAIlL8uyYMSw0zs7bRv/f9+52y33Ul1X2/U4AroqOohgFbEoaxaqQzwqtgZp8ljHunA4+5+4/jraj+mdlpwGvAO1SM7X+XMK/xDNCLcFn5S9y98gRbSjCzUcDN7n6umR1F6Hl0BN4Gvujue2Isr16Z2SDCxH8WsBz4EuGPxpT+rs3sh8AXCEcLvg1cTRi/T6nv2sz+AIwiXAL9Y+AHwGSq+H6jAH2QMFS3E/iSuxcl/VkKDRERSZaGp0REJGkKDRERSZpCQ0REkqbQEBGRpCk0REQkaQoNERFJmkJDRESS9v8BuQ1fLgg5BRUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#画图\n",
    "import matplotlib.pyplot as plt\n",
    "plt.figure()\n",
    "plt.plot(n, l, color  = 'orange', linewidth = 2, label = 'loss')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8016bc59",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4e8f3947",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pytorch",
   "language": "python",
   "name": "pytorch"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
